<?php
/**
 * Created by PhpStorm.
 * User: DOVEGIFT
 * Date: 2019/8/1
 * Time: 9:11
 */
header("Content-Type:application/json;charset=uft-8");
header("Access-Control-Allow-Origin:*");

if (isset($_REQUEST["pid"])){
  $PID=$_REQUEST["pid"];

  $goodsListStr=file_get_contents("./data/goodsList.json");
  $googdListArr=json_decode($goodsListStr);
  //
    for($i=0;$i<count($googdListArr);$i++){
        if($googdListArr[$i]->pid==$PID){
            print_r(json_encode($googdListArr[$i]));
            break;
        }
    }
  } else {
  print_r(file_get_contents("./data/goodsList.json"));
}

